package com.zhangdi.dwdata.query;

import org.hibernate.Session;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

/**
 * Created by zhangdi on 2020/09/15 16:00:52.
 */
public class Finder<T> extends QFinder {
    private CriteriaBuilder builder;
    private CriteriaQuery<T> query;
    private Root<T> root;

    public Finder(CriteriaBuilder builder, Class<T> clazz){
        this.builder = builder;
        this.query = builder.createQuery(clazz);
        this.root = query.from(clazz);
    }

    public CriteriaBuilder getBuilder() {
        return builder;
    }

    public void setBuilder(CriteriaBuilder builder) {
        this.builder = builder;
    }

    public CriteriaQuery<T> getQuery() {
        return query;
    }

    public void setQuery(CriteriaQuery<T> query) {
        this.query = query;
    }

    public Root<T> getRoot() {
        return root;
    }

    public void setRoot(Root<T> root) {
        this.root = root;
    }
}
